Text Processing with Ruby (for Embach Mark) by Rob Miller
Author:Rob Miller
Language: eng
Format: epub
Tags: Pragmatic Bookshelf
ISBN: 978-1-68050-070-7
Publisher: The Pragmatic Bookshelf, LLC (573151)
â puts â"Matches!"â âifâ word.match(â/\A[ââ#{âlettersâ}ââ]+\z/oâ)
â âendâ
Then, when running the script with time, weâll see the following output:
â $ âtimeââ âârubyââ ââo-modifier.rbâ
â letters() called
â Matches!
â Matches!
â Matches!
â Matches!
â Matches!
â Matches!
â Matches!
â Matches!
â Matches!
â
â real 0m1.031s
â user 0m0.024s
â sys 0m0.005s
We can see from the output that the letters method was called only onceâwhen the first word was matchedâand then not again. This resulted in the script taking just over one second to execute, rather than the previous nine seconds.
Of course, this is a rather extreme example; itâs rare that youâll find yourself needing to interpolate the result of a calculation that takes this long into a regular expression, and on top of that to be doing it inside a loop. But if you do, itâs worth remembering the o modifier.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7810)
Grails in Action by Glen Smith Peter Ledbrook(7719)
Azure Containers Explained by Wesley Haakman & Richard Hooper(6840)
Configuring Windows Server Hybrid Advanced Services Exam Ref AZ-801 by Chris Gill(6839)
Running Windows Containers on AWS by Marcio Morales(6367)
Kotlin in Action by Dmitry Jemerov(5092)
Microsoft 365 Identity and Services Exam Guide MS-100 by Aaron Guilmette(5070)
Combating Crime on the Dark Web by Nearchos Nearchou(4648)
Microsoft Cybersecurity Architect Exam Ref SC-100 by Dwayne Natwick(4616)
Management Strategies for the Cloud Revolution: How Cloud Computing Is Transforming Business and Why You Can't Afford to Be Left Behind by Charles Babcock(4438)
The Ruby Workshop by Akshat Paul Peter Philips Dániel Szabó and Cheyne Wallace(4335)
The Age of Surveillance Capitalism by Shoshana Zuboff(3979)
Python for Security and Networking - Third Edition by José Manuel Ortega(3895)
The Ultimate Docker Container Book by Schenker Gabriel N.;(3555)
Learn Wireshark by Lisa Bock(3531)
Learn Windows PowerShell in a Month of Lunches by Don Jones(3528)
Mastering Python for Networking and Security by José Manuel Ortega(3376)
Mastering Azure Security by Mustafa Toroman and Tom Janetscheck(3356)
Blockchain Basics by Daniel Drescher(3325)
